// 微信小游戏适配器
const { platform } = wx.getSystemInfoSync()

// 创建全局 canvas
const canvas = wx.createCanvas()
const context = canvas.getContext('2d')

// 设置 canvas 尺寸
const { windowWidth, windowHeight } = wx.getSystemInfoSync()
canvas.width = windowWidth
canvas.height = windowHeight

// 导出全局对象
Object.assign(GameGlobal, {
  canvas,
  context,
  innerWidth: windowWidth,
  innerHeight: windowHeight,
  devicePixelRatio: 1,
  performance: Date,
  XMLHttpRequest: function() {
    return wx.request
  },
  WebSocket: function(url) {
    return wx.connectSocket({
      url: url
    })
  }
})

// 导出 App 函数
GameGlobal.App = function(options) {
  return options
} 